/*
 * PlaylistInsertAction.java
 *
 * Created on April 8, 2006, 1:28 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.bff.slimserver.musicjukebox.lib.actions;

import com.bff.bjj.utils.Resources;
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import org.bff.slimserver.SlimPlaylist;
import org.bff.slimserver.exception.SlimException;
import org.bff.slimserver.musicobjects.SlimFolderObject;

/**
 *
 * @author Bill
 */
public class PlaylistLoadFolderAction extends FolderAction {
    
    /** Creates a new instance of PlaylistInsertAction */
    public PlaylistLoadFolderAction(SlimPlaylist playlist, 
            Collection<SlimFolderObject> folders) {
        super(playlist, folders);
        putValue(Action.NAME, Resources.getMessage(Resources.LABEL_KEY.ACTION_LOAD_FOLDER_NAME));
        putValue(Action.SHORT_DESCRIPTION, Resources.getMessage(Resources.LABEL_KEY.ACTION_LOAD_FOLDER_SHORT_DESC));
        putValue(Action.SMALL_ICON, Resources.getIcon(Resources.ICON_KEY.ACTION_LOAD_FOLDER));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        try {
            getPlaylist().loadFolderItems(getFolders());
        } catch (SlimException ex) {
            Logger.getLogger(PlaylistLoadFolderAction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }   
}
